<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>新增-功能类别</title>
    <link rel="stylesheet" th:href="@{/resources/bootstrap/css/bootstrap.min.css}">
    <!-- Font Awesome -->
    <link rel="stylesheet" th:href="@{/resources/awi/css/font-awesome.min.css}">
    <!-- Theme style -->
    <link rel="stylesheet" th:href="@{/resources/awi/css/AdminLTE.min.css}">
    <link rel="stylesheet" th:href="@{/resources/awi/css/skins/all-skins.min.css}">
    <!--File input -->
    <link rel="stylesheet" th:href="@{/resources/plugins/bootstrap-fileinput/css/fileinput.min.css}">
</head>
<body>
<div class="container-fluid">
<div class="row">
    <div class="col-md-12">
        <div class="page-header">
            <h3>管理设置
                <small>流程发布</small>
            </h3>
        </div>
    </div>
</div>
    <div class="row">
        <div class="col-md-10 col-md-offset-1">
            <div class="box box-solid box-info">
                <div class="box-body">
                    <form role="form" id="authCategory-form" action="/authCategory/save"  method="post">
                        <input type="hidden" name="uid">
                            <div class="form-group">
                                <label for="processName">流程名称 </label>
                                <input  type="text" class="form-control" name="processName" id="processName" placeholder="流程名称">
                            </div>
                            <div class="form-group">
                                <label for="category">流程类别 </label>
                                <input  type="text" class="form-control" name="category" id="category" placeholder="流程类别">
                            </div>
                        <div class="form-group">
                            <label for="bpmnFile">流程文件 </label>
                            <input type="file" class="form-control fileinput" name="bpmnFile" id="bpmnFile" >
                        </div>
                        <div class="form-group">
                            <label for="description">流程描述 </label>
                            <textarea class="form-control" name="description" id="description" rows="4" >
                            </textarea>
                        </div>
                    </form>

                </div>
                <div class="box-footer">
                    <button type="button" id="submitBtn"  class="btn btn-primary pull-right" style="margin-left: 35px;" onclick="processDeploy()">提交</button>
                </div>
            </div>


        </div>

    </div>

</div>
</body>
<!-- jQuery 2.2.3 -->
<script th:src="@{/resources/plugins/jQuery/jquery-2.2.3.min.js}"></script>
<!-- Bootstrap 3.3.6 -->
<script th:src="@{/resources/bootstrap/js/bootstrap.min.js}"></script>
<script th:src="@{/resources/layer/layer.js}"></script>
<!-- AdminLTE App -->
<script th:src="@{/resources/awi/js/app.js}"></script>
<!--tabs-->
<script th:src="@{/resources/awi/js/app_iframe.js}"></script>
<script th:src="@{/resources/commons/js/prototype.js}"></script>
<!--文件上传控件 -->
<script th:src="@{/resources/plugins/bootstrap-fileinput/js/fileinput.min.js}"></script>
<script th:src="@{/resources/plugins/bootstrap-fileinput/js/fileinput_locale_zh.js}"></script>
<script type="text/javascript">
    $(function () {
        $(".fileinput").fileinput({
            language: 'zh',
            uploadUrl: '/processSetting/deploy',
            uploadAsync: true, //默认异步上传
            showPreview: false, //是否显示预览
            showCaption: true,//是否显示标题
            browseClass: "btn btn-info", //按钮样式
            dropZoneEnabled: false,//是否显示拖拽区域
            uploadExtraData:function () {
               var data =  {"processName":$("#processName").val(),"category":$("#category").val(),"description":$("#description").val()};
               return data;
            }
        });
    })

    function processDeploy(){
        $('#bpmnFile').fileinput('upload').on("filebatchuploadsuccess",function(event, data, previewId, index){
            layer.msg("流程部署成功");
            var parentIndex = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
            parent.layer.close(parentIndex);
        })
    }

</script>
</html>